<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
</head>
<body>
  <div id="app">
    <div>
      <p >{{ word }}</p>
      <button @click="speakJoke">点击说笑话</button>
    </div>
  </div>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        word: '这里是一条笑话',
        jokeArr: ['我去相亲网站去了, 那你找到对象了吗? 不! 我找到了他们网站的一个Bug', '讲述一下车怎么翻沟里了。我坐在副驾说沟！沟!沟! 朋友说：欧嘞，欧嘞。欧嘞 结果车就翻里了。', '几位大哥开车去钓鱼，车陷草里了，然后几个大神说把草烧了就出来了，然后就放火烧了，结果就烧没了。']
      },
      methods: {
        speakJoke() {
          const random =  Math.floor(Math.random() * this.jokeArr.length)
          console.log(random)
          this.word = this.jokeArr[random]
        }
      }
    })
  </script>
</body>
</html>